#define _CRT_SECURE_NO_WARNINGS

#include"SeqList.h"

void TestSL1()
{
    SL sl;
    SeqListInit(&sl);
    SeqListPushBack(&sl, 1);
    SeqListPushBack(&sl, 2);
    SeqListPushBack(&sl, 3);
    SeqListPushBack(&sl, 4);
    SeqListPushBack(&sl, 5);
    SeqListPrint(&sl);

    //SeqListPopBack(&sl);
    //SeqListPrint(&sl);
    SeqListPopBack(&sl);
    SeqListPopBack(&sl);
    SeqListPopBack(&sl);
    SeqListPopBack(&sl);
    SeqListPrint(&sl);
    SeqListPopBack(&sl);
    SeqListPrint(&sl);

    SeqListPushBack(&sl, 5);
    SeqListPrint(&sl);

    SeqListDestory(&sl);
}

void TestSL2()
{
    SL sl;
    SeqListInit(&sl);
    SeqListPushFront(&sl, 1);
    SeqListPushFront(&sl, 2);
    SeqListPushFront(&sl, 3);
    SeqListPushFront(&sl, 4);
    SeqListPushFront(&sl, 5);
    SeqListPrint(&sl);

    //SeqListPopFront(&sl);
    //SeqListPrint(&sl);
    SeqListPopFront(&sl);
    SeqListPopFront(&sl);
    SeqListPopFront(&sl);
    SeqListPopFront(&sl);
    SeqListPrint(&sl);
    SeqListPopFront(&sl);
    SeqListPrint(&sl);

    SeqListDestory(&sl);
}

void TestSL3()
{
    SL sl;
    SeqListInit(&sl);
    SeqListPushFront(&sl, 1);
    SeqListPushFront(&sl, 2);
    SeqListPushFront(&sl, 3);
    SeqListPushFront(&sl, 4);
    SeqListPushFront(&sl, 5);
    SeqListPrint(&sl);

    size_t pos = SeqListFind(&sl, 1);
    if (pos == -1)
    {
        printf("not find");
        return;
    }

    SeqListInsert(&sl, 9, pos);
    SeqListPrint(&sl);
    SeqListErase(&sl, pos);
    SeqListPrint(&sl);

    SeqListDestory(&sl);
}

int main()
{
    TestSL1();
    puts("");
    TestSL2();
    puts("");
    TestSL3();

    return 0;
}